import java.util.Scanner;

public class Test {//https://leetcode.cn/problems/valid-palindrome/submissions/614141887/
    public static boolean huiwenshu(String s2) {
        s2= s2.toLowerCase();
        int i=0;
        int j=s2.length()-1;
        while(i<j){//这个别搞忘，若无这个if只会执行一次，会造成回文数判读错误
            while(i<j&&!isCharacterorNumber(s2.charAt(i))){//i<j防止越界
                i++;
            }while(i<j&&!isCharacterorNumber(s2.charAt(j))){
                j--;
            }if(s2.charAt(i)==s2.charAt(j)){
                i++;
                j--;
            }else{
                return false;
            }

        }
        return true;

    }

    public static boolean isCharacterorNumber(char ch) {
        if((ch>='0'&&ch<='9')||(ch<='z'&&ch>='a')){
            return true;
        }else{
            return false;
        }
    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNextLine()){
            String s1=scanner.nextLine();
            boolean r=huiwenshu(s1);
            System.out.println(r);
        }
    }
}
